import { View } from "@tarojs/components";
import { useState, useEffect } from "react";
import Taro from "@tarojs/taro";
import { AtInput, AtForm, AtButton, AtRadio, AtIcon } from "taro-ui";

// 按需引入
import "./index.scss";

const IntoPackage = () => {
  const handleCamera = () => {
    Taro.scanCode({
      success: res => {
        console.log(res);
      }
    });
  };

  return (
    <View className="container">
      <AtForm>
        <View className="panel-title">产品信息</View>
        <AtInput
          name="value2"
          title="产品条码"
          type="text"
          placeholder="请输入产品条码"
          value={""}
          onChange={() => {}}
        >
          <AtIcon
            onClick={handleCamera}
            value="camera"
            size="28"
            color="#3c3c3c"
          ></AtIcon>
        </AtInput>
        <AtInput
          name="value2"
          title="数量"
          type="number"
          placeholder="请输入数量"
          value={""}
          onChange={() => {}}
        />
        <View className="panel-title">入包类型</View>
        <AtRadio
          options={[
            { label: "购买", value: "option1" },
            { label: "自带", value: "option2" },
            { label: "转移", value: "option3" }
          ]}
          value={"option1"}
          onClick={() => {}}
        />
      </AtForm>

      <AtButton type="primary">入包</AtButton>

      <AtButton type="secondary">取消</AtButton>
    </View>
  );
};

export default IntoPackage;
